<?php
/*=======================================================================
 Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System
 =======================================================================*/
include_once(NUKE_BASE_DIR.'header.php');
include_once('modules/'.$module_name.'/admin/UploadMenu.php');
include_once('modules/'.$module_name.'/admin/classes/Pagination.php');
OpenTable();

$total_records = $db->sql_numrows($db->sql_query("SELECT * FROM " . $prefix . "_upload GROUP BY username "));

$page = 1;
// how many records per page
$size = 20;
// we get the current page from $_GET
if (isset($_GET['page'])){
    $page = (int) $_GET['page'];
}
// create the pagination class
$pagination = new Pagination();
$pagination->setLink("admin.php?op=Uploadusers&amp;page=%s");
$pagination->setPage($page);
$pagination->setSize($size);
$pagination->setTotalRecords($total_records);
 
echo"<h1><u>User list</u></h1>";
  
//hier een while lus om door al de users te gaan die afbeeldingen hebben geupload en een link naar detailpagina
//$SQL = "SELECT * FROM mytable " . $pagination->getLimitSql();
$sql="SELECT * FROM " . $prefix . "_upload GROUP BY username " . $pagination->getLimitSql();
$result = $db->sql_query($sql);
echo"<ul id=\"userlist\">";
while($site_row = $db->sql_fetchrow($result))
{
	$img_amount = $db->sql_fetchrow($db->sql_query("SELECT count(id) AS `count` FROM ".$prefix."_upload WHERE username='".$site_row['username']."'"));
	echo"<li><img src=\"modules/Upload/display/userlist.png\" alt=\"userlist\" border=\"0\" /> <a href=\"".$admin_file.".php?op=Uploaduserdetail&amp;username=".$site_row['username']."\">".$site_row['username']." - <strong>".$img_amount['count']."</strong> uploaded images</a></li>";
}
echo"</ul><div id=\"pagination\">";
$navigation = $pagination->create_links();
echo $navigation."</div>"; // will draw our page navigation

CloseTable();
include_once(NUKE_BASE_DIR.'footer.php');
?>